<template>
	<view class="page">
		<view class="content">


			<u-list>
				<u-list-item v-for="(item, index) in itemArr" :key="index" >
					<u-cell :title="item.carName" @click="series(item.id)">
						<u-avatar slot="icon" shape="square" size="35" :src="item.carImg"
							customStyle="margin: -3px 5px -3px 0"></u-avatar>
					</u-cell>
				</u-list-item>
			</u-list>
		</view>
	</view>
</template>

<script>
	import {
		apigetByBrandId
	} from '@/api/car.js'
	export default {
		data() {
			return {
				indexList: ["你好"],
				itemArr: []
			}
		},
		created() {
			this.getByBrandId()
		},
		methods: {

			series(id) {
				console.log(id)
				this.$store.commit("setcarseries", id)
				this.$emit("carseries")
			},
			getByBrandId() {
				let id = this.$store.state.brand
				console.log(this.$store.state.brand)
				apigetByBrandId(id).then((res) => {

					this.itemArr = res.data
					console.log(this.itemArr)
				})
			}
		},
	}
</script>

<style scoped lang="scss">
	.content {
		margin: 16rpx;
		background-color: #fff;
		border-radius: 10rpx;
	}

	.list-cell {
		display: flex;
		box-sizing: border-box;
		width: 100%;
		padding: 10px 24rpx;
		overflow: hidden;
		color: #323233;
		font-size: 14px;
		line-height: 24px;
		background-color: #fff;
		border-bottom: #c3c3c7 1rpx solid;

		.cell {
			margin: 15rpx;
			font-size: 32rpx;
			font-weight: 500;
		}
	}
</style>